/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2024-03-27 15:51:12
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-04-09 17:02:46
 * @FilePath: /yt-devops/lib/pages/devices/device_tab/basic_info/setting/setting_form/setting_form_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import 'package:reactive_forms/reactive_forms.dart';

class OptionModel {
  String label;
  dynamic value;

  OptionModel(this.label, this.value);
}

class FormItemProps {
  bool hidden;

  bool required;

  void Function(Map data, OptionModel)? onSelectChange;

  FormItemProps(
      {this.hidden = false, this.required = false, this.onSelectChange});
}

enum FormItemType { input, selectPicker }

typedef RequestCallBack = Future<List<OptionModel>> Function(Map formData);

class SettingFormModel {
  //
  String key;

  String title;

  FormItemType valueType;

  RequestCallBack? request;

  FormItemProps? formItemProps;

  SettingFormModel(
      {required this.key,
      required this.title,
      this.valueType = FormItemType.input,
      this.request,
      this.formItemProps});
}
